use std::io;
fn main() {
    //get input
    let mut input = String::new();
    println!("Please enter a number above 0: ");
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line!");
    let num: u32 = input
        .trim()
        .parse()
        .expect("Not a number!");
    if num <= 0 {
        println!("The number is smaller than 1!");
        return;
    }
    let result = get_fibonacci(num);
    println!("The {num}th number of Fibonacci Sequence is {result}.");
}
fn get_fibonacci(num: u32) -> u32 {
    if num <=0 {
        return 0;
    }
    if num == 1 {
        return 0;
    }
    if num == 2 {
        return 1;
    }
    return get_fibonacci(num - 2) + get_fibonacci(num - 1);
}
